package com.wuzao.MediatorPattern;


import com.wuzao.MediatorPattern.components.*;
import com.wuzao.MediatorPattern.mediator.Editor;
import com.wuzao.MediatorPattern.mediator.Mediator;

import javax.swing.*;

/**
 * 中介者模式是一种行为设计模式，能让你减少对象之间混乱无序的依赖关系。 该模式会限制对象之间的直接交互， 迫使它们通过一个中介者对象进行合作。
 */
public class Demo {
    public static void main(String[] args) {
        Mediator mediator = new Editor();

        mediator.registerComponent(new Title());
        mediator.registerComponent(new TextBox());
        mediator.registerComponent(new AddButton());
        mediator.registerComponent(new DeleteButton());
        mediator.registerComponent(new SaveButton());
        mediator.registerComponent(new List(new DefaultListModel()));
        mediator.registerComponent(new Filter());

        mediator.createGUI();
    }
}
